package org.zcl.sqlserver.feign.facade;

import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.zcl.sqlserver.entity.CreateForBooking;
import org.zcl.sqlserver.feign.client.CouponClient;

import javax.annotation.Resource;
import java.util.Map;

@Component
@Slf4j
public class CouponFacade {


    @Resource
    private CouponClient couponClient;

    public String createCoupon(CreateForBooking createForBooking) {
        log.info("loyalty-coupon createCoupon request:{}", JSON.toJSONString(createForBooking));
        Map<String, Object> couponForSBooking = couponClient.createCouponForSBooking(createForBooking);
        String couponID = (String) couponForSBooking.get("CouponID");
        log.info("loyalty-coupon createCoupon response:{}", JSON.toJSONString(couponID));
        return couponID;
    }
}